import React from 'react'
import { Descriptions, Tag } from 'antd'

export default function PersonInfo(props: any) {


    //得到显示字段
    function getDisplayItem(data: any) {
        if (data === "" || typeof data === "undefined" || data === null)
            return "--"
        return data
    }
    return (
        <Descriptions bordered>
            <Descriptions.Item label="姓名">{getDisplayItem(props.content.userName)}</Descriptions.Item>
            <Descriptions.Item label="联系电话" span={2}>{getDisplayItem(props.content.phone)}</Descriptions.Item>
            <Descriptions.Item label="角色" span={3}>{props.content.roleList.map((item: any, index: number) => <Tag color="blue" key={index}>{item.roleName}</Tag>)}</Descriptions.Item>
            <Descriptions.Item label="管理部门" span={3}>{props.content.deptRelList.map((item: any, index: number) => <Tag key={index} color="green">{item}</Tag>)}</Descriptions.Item>
            <Descriptions.Item label="权限" span={3}>{props.content.authList.map((item: any, index: number) => <Tag key={index} color="orange">{item.authName}</Tag>)}</Descriptions.Item>
        </Descriptions>
    )
}
